package com.ayoka.adapter;

import android.widget.ImageView;

import com.ayoka.R;
import com.ayoka.bean.CouponBean;
import com.jcp.baselibrary.brvah.BaseQuickAdapter;
import com.jcp.baselibrary.brvah.BaseViewHolder;
import com.jcp.baselibrary.utils.StringUtil;
import com.jincp.image.load.ImageLoaderOptions;
import com.jincp.image.load.ImageLoaderProxy;

import java.util.List;

/**
 * Created by jinchunping on 2018/4/11.
 */

public class CouponAdapter extends BaseQuickAdapter<CouponBean, BaseViewHolder> {

    public CouponAdapter() {
        super(R.layout.item_coupon, null);
    }

    @Override
    protected void convert(BaseViewHolder holder, CouponBean item) {
        ImageLoaderProxy.getInstance().displayImage(item.ImgUrl, (ImageView) holder.getView(R.id.iv_coupon_picture), ImageLoaderOptions.getRoundOptions());
        holder.setText(R.id.tv_coupon_title, item.Title)
                .setText(R.id.tv_coupon_name, item.Descp)
                .setText(R.id.tv_coupon_status, item.getUseStatus())
                .setText(R.id.tv_expiry_date, StringUtil.formatString(R.string.format_expiry_date, item.ExpiredDate));
    }
}
